package cn.appsys.service.dictionary;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.appsys.dao.dictionary.DictionaryMapper;
import cn.appsys.pojo.DataDictionary;
import cn.appsys.tools.Constants;
import cn.appsys.tools.PageSupport;

/**
 * 数据字典业务层的实现类
 * @author 寇超强
 *
 */
@Service
public class DictionaryServiceImpl implements DictionaryService{
	@Resource
	private DictionaryMapper dicMapper;
	@Override
	public List<DataDictionary> getDicInfo(String valueName,PageSupport page) {
		// TODO Auto-generated method stub
		page.setPageSize(Constants.pageSize);
		page.setTotalCount(getCount(valueName));
		if(page.getCurrentPageNo()>page.getTotalPageCount())
			page.setCurrentPageNo(page.getTotalPageCount());
		int currentPageNo=(page.getCurrentPageNo()-1)*page.getPageSize();
		return dicMapper.getDicInfo(valueName,currentPageNo,Constants.pageSize);
	}
	@Override
	public Integer getCount(String valueName) {
		// TODO Auto-generated method stub
		return dicMapper.getCount(valueName);
	}
	
	
}
